#include "common/api/server.h"
#include "common/api/server_helper.hpp"

#include "api_controller.h"

#include "has_changes_handler.h"

namespace Api
{

HasChangesHandler::HasChangesHandler(
    crow::App<>& crowApplication,
    ApiController* controller
)
    : m_controller(controller)
{
    ADD_CROW_ROUTE_HAS_CHANGES(
        crowApplication,
        [this](const Uuids::Uuid& sessionUuid) -> Api::Changes
        {
            // TODO : добавить проверку прав
            return m_controller->changesManager().pop(sessionUuid);
        }
    );
}

} // namespace Api
